clear all
set memo 100m
capture log close

local filename Placebo

log using Placebo, replace text

local output_dir draft
local output_tex1 `filename'.tex


cd "C:\Users\rujia\Dropbox\\Replication\treatyports"

use data/subgroup.dta, clear

gen ln_popu1776=log(hpopu1776)
gen ln_popu1820=log(hpopu1820)

gen preGrowth=(hpopu1820-hpopu1776)/hpopu1776/44*100

local controls "silk tea dis_yunhe longitude latitude landtax taiping"


#delimit ;
eststo clear;

eststo: regress ln_popu1776 nativecustoms `controls';
estadd local controls "Y";
estadd scalar nobs=e(N);
estadd scalar rsqaure=e(r2);

eststo:  regress ln_popu1820 nativecustoms `controls';
estadd local controls "Y";
estadd scalar nobs=e(N);
estadd scalar rsqaure=e(r2);

eststo:  regress preGrowth nativecustoms `controls';
estadd local controls "Y";
estadd scalar nobs=e(N);
estadd scalar rsqaure=e(r2);

	use data/nonSubgroup.dta, clear;
	sort name;
    merge 1:1 name using data/nativecustoms.dta;
	replace nativecustoms=0 if nativecustoms==.;
	
	
gen postGrowth=(hpopu1953-hpopu1910)/hpopu1910/43*100;
	
eststo:  regress postGrowth nativecustoms `controls';
estadd local controls "Y";
estadd scalar nobs=e(N);
estadd scalar rsqaure=e(r2);



esttab using draft/`output_tex1', replace
	width(\hsize) 
	mlabel (, depvar)
	b(3)
	se(3)
	noconstant
	star(* 0.10 ** 0.05 *** 0.01)
	keep(
nativecustoms
		)
		
	label
	stats(
		
		controls
		 nobs
		 rsquare
		, 
		labels(
	
			"Controls" 
			"\# observations"
			"R-squared"
			) 
		fmt(0)
		layout(@)
		)
	nonotes
	;
	
	


